/*
 * @Author: 杜家璇
 * @Date: 2023-06-27 09:07:03
 * @LastEditors: 杜家璇
 * @LastEditTime: 2023-08-02 14:21:47
 * @FilePath: \weiNingWeb\src\utils\common.js
 * @Description:  
 * 
 * Copyright (c) 2023 by 用户/公司名, All Rights Reserved. 
 */
import store from "../store/index"
import router from '../router/index'
export function debounce(fn, delay = 1000) {
  let timer = null
  return function () {
    let args = arguments
    if (timer) {
      clearTimeout(timer)
      timer = null
    }
    timer = setTimeout(() => {
      fn.apply(this, args)// this 指向vue
    }, delay)
  }
}

// export function getPageImgInfo(){
//   let list = store.state.pageHeadImg;
//   console.log(list)
//   let obj = list.find(item=>{
//     return item.contentHtml.indexOf(router.currentRoute.name) >= 0 ? true : false;
//   });
//   console.log(obj)
//   return obj
// }
// 判断是否是外链
export function isWldz(url){
  let index = url.indexOf('http://');
  let index2 = url.indexOf('https://');
  if((index >= 0) || (index2 >= 0)){
    return true
  }else{
    return false
  }
}